using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class NHOMHANGInfo
    {
		#region Local Variable
		public enum Field
		{
			NHOMHANG,
			TENNHOM
		}
		private String _NHOMHANG;
		private String _TENNHOM;
		
		public String NHOMHANG{	get{ return _NHOMHANG;} set{_NHOMHANG = value;} }
		public String TENNHOM{	get{ return _TENNHOM;} set{_TENNHOM = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public NHOMHANGInfo()
		{
			_NHOMHANG = "";
			_TENNHOM = "";
		}
		public NHOMHANGInfo(
		String NHOMHANG,
		String TENNHOM
		)
		{
			_NHOMHANG = NHOMHANG;
			_TENNHOM = TENNHOM;
		}
		public NHOMHANGInfo(DataRow dr)
		{
			if (dr != null)
			{
				_NHOMHANG = dr[Field.NHOMHANG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NHOMHANG.ToString()]);
				_TENNHOM = dr[Field.TENNHOM.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TENNHOM.ToString()]);
			}
		}
		public NHOMHANGInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_NHOMHANG = dr[Field.NHOMHANG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NHOMHANG.ToString()]);
				_TENNHOM = dr[Field.TENNHOM.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TENNHOM.ToString()]);
			}
		}
		public NHOMHANGInfo(NHOMHANGInfo objEntr)
		{			
			_NHOMHANG = objEntr.NHOMHANG;			
			_TENNHOM = objEntr.TENNHOM;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("NHOMHANG");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.NHOMHANG.ToString(), typeof(String)),
				new DataColumn(Field.TENNHOM.ToString(), typeof(String))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.NHOMHANG.ToString()] = _NHOMHANG;
			row[Field.TENNHOM.ToString()] = _TENNHOM;
			return row;
		}
        #endregion InitTable
    }
}
